<script>
    import List from '../components/list.svelte';
    import Btn from '../components/btn.svelte';
    import QueryBar from '../components/queryBar.svelte';
    import Paging from '../components/paging.svelte';
    import { onMount } from 'svelte';
    import { Post } from '../lib/net.js';
    import { AgentListDashboard,AgentList } from '../api.js';
    import Query from '../model/query.js';
    import moment from 'moment';
    
    let info = {
        total: 0,
        many: 0,
        less: 0,
    }
    var query = new Query();

    async function getList(){
       let ret = await Post(AgentList,query)
       query.total = ret.total;
       let _data = [];
       for(let item of ret.list) {
        let arr = [`<a href="#/agent/users?agent_id=${item.id}"> ${item.id} </a>`,item.userinfo.name,item.phone,item.userinfo.id,"","","","",moment(item.createDate).format("YYYY-MM-DD hh:mm:ss"),"一级代理","",item.state === 0 ? "正常": "冻结"];
        _data.push(arr);
       }
       data.data = _data;
    }

</script>

<div class="view">
    <div class="container info">
        <div class="columns">
            <div class="column is-6">
                <nav class="level">
                    <div class="level-item has-text-centered">
                        <div>
                            <p class="heading">当前委托量(USDT)</p>
                            <p class="title">{info.total}</p>
                        </div>
                    </div>
                    <div class="level-item has-text-centered">
                        <div>
                        <p class="heading">委托多单数量</p>
                        <p class="title">{info.money}</p>
                        </div>
                    </div>
                    <div class="level-item has-text-centered">
                        <div>
                        <p class="heading">委托空单数量</p>
                        <p class="title">{info.less}</p>
                        </div>
                    </div>
                </nav>
            </div>
            <div class="column is-6"></div>
        </div>
    </div>

</div>

<style>
    .container {
        margin: 20px;
    }
    .info {
        background: #fff;
    }
</style>
